<?php

namespace common\validate;

use think\Validate;

class UserAuthentication extends BaseValidate
{
    //验证规则
    protected $rule = [];

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'array')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Submit 验证场景定义
    public function sceneSubmit()
    {
        return $this->append('data', 'require')
            ->append('data.user_authentication', 'require')
            ->append('data.user_authentication.id', 'integer')
            ->append('data.user_authentication.user_id', 'require|integer')
            ->append('data.user_authentication.status', 'in:submitting,to_be_reviewed,active,invalid')
            ->append('data.user_authentication.real_name', 'require|max:128')
            ->append('data.user_authentication.id_number', 'require|max:18')
            ->append('data.user_authentication.phone', 'require|max:20')
            ->append('data.user_authentication.bank_account', 'max:24')
            ->append('data.media_front_of_id', 'require|array')
            ->append('data.media_reverse_of_id', 'require|array');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.status', 'in:submitting,to_be_reviewed,active,invalid')
            ->append('data.bank_account', 'max:24')
            ->append('data.real_name', 'max:128')
            ->append('data.id_number', 'max:18')
            ->append('data.phone', 'max:20');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }


}
